<script setup>
  import { ref } from 'vue'
  const list = ref([])
  uni.$on('listEdit', (e) => {
    const oldList = list.value.find((v) => v.id === +e.id)
    Object.assign(oldList, e)
  })
  for (let i = 0; i < 100; i++)
    list.value.push({ id: i + 1, name: '张三' + (i + 1) })
  const edit = (v) => {
    uni.navigateTo({
      url:
        '/pages/test-event-channel-edit/test-event-channel-edit?detail=' + v.id
      // success(e) {
      //   e.eventChannel.on('listEdit', (e) => {
      //     console.log(e)
      //     const oldList = list.value.find((v) => v.id === +e.id)
      //     Object.assign(oldList, e)
      //   })
      // }
    })
  }
</script>
<template>
  <view v-for="v in list" :key="v.id">
    {{ v }}
    <button @click="edit(v)">编辑</button>
  </view>
</template>

<style></style>
